
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class OleDbEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.OleDb;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace Alserve.Ffl.Data
{
	public abstract class _NewsFeed : OleDbEntity
	{
		public _NewsFeed()
		{
			this.QuerySource = "NewsFeed";
			this.MappingName = "NewsFeed";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override string GetAutoKeyColumn()
		{
			return "Id";
		}

		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_NewsFeedLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int Id)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.Id, Id);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_NewsFeedLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static OleDbParameter Id
			{
				get
				{
					return new OleDbParameter("@Id", OleDbType.Numeric, 0);
				}
			}
			
			public static OleDbParameter NewsDate
			{
				get
				{
					return new OleDbParameter("@NewsDate", OleDbType.Date, 0);
				}
			}
			
			public static OleDbParameter Headline
			{
				get
				{
					return new OleDbParameter("@Headline", OleDbType.VarWChar, 255);
				}
			}
			
			public static OleDbParameter Details
			{
				get
				{
					return new OleDbParameter("@Details", OleDbType.VarWChar, 255);
				}
			}
			
			public static OleDbParameter Url
			{
				get
				{
					return new OleDbParameter("@Url", OleDbType.VarWChar, 255);
				}
			}
			
			public static OleDbParameter ImageURL
			{
				get
				{
					return new OleDbParameter("@ImageURL", OleDbType.VarWChar, 255);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string Id = "Id";
            public const string NewsDate = "NewsDate";
            public const string Headline = "Headline";
            public const string Details = "Details";
            public const string Url = "Url";
            public const string ImageURL = "ImageURL";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[Id] = _NewsFeed.PropertyNames.Id;
					ht[NewsDate] = _NewsFeed.PropertyNames.NewsDate;
					ht[Headline] = _NewsFeed.PropertyNames.Headline;
					ht[Details] = _NewsFeed.PropertyNames.Details;
					ht[Url] = _NewsFeed.PropertyNames.Url;
					ht[ImageURL] = _NewsFeed.PropertyNames.ImageURL;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string Id = "Id";
            public const string NewsDate = "NewsDate";
            public const string Headline = "Headline";
            public const string Details = "Details";
            public const string Url = "Url";
            public const string ImageURL = "ImageURL";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[Id] = _NewsFeed.ColumnNames.Id;
					ht[NewsDate] = _NewsFeed.ColumnNames.NewsDate;
					ht[Headline] = _NewsFeed.ColumnNames.Headline;
					ht[Details] = _NewsFeed.ColumnNames.Details;
					ht[Url] = _NewsFeed.ColumnNames.Url;
					ht[ImageURL] = _NewsFeed.ColumnNames.ImageURL;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string Id = "s_Id";
            public const string NewsDate = "s_NewsDate";
            public const string Headline = "s_Headline";
            public const string Details = "s_Details";
            public const string Url = "s_Url";
            public const string ImageURL = "s_ImageURL";

		}
		#endregion		
		
		#region Properties
	
		public virtual int Id
	    {
			get
	        {
				return base.Getint(ColumnNames.Id);
			}
			set
	        {
				base.Setint(ColumnNames.Id, value);
			}
		}

		public virtual DateTime NewsDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.NewsDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.NewsDate, value);
			}
		}

		public virtual string Headline
	    {
			get
	        {
				return base.Getstring(ColumnNames.Headline);
			}
			set
	        {
				base.Setstring(ColumnNames.Headline, value);
			}
		}

		public virtual string Details
	    {
			get
	        {
				return base.Getstring(ColumnNames.Details);
			}
			set
	        {
				base.Setstring(ColumnNames.Details, value);
			}
		}

		public virtual string Url
	    {
			get
	        {
				return base.Getstring(ColumnNames.Url);
			}
			set
	        {
				base.Setstring(ColumnNames.Url, value);
			}
		}

		public virtual string ImageURL
	    {
			get
	        {
				return base.Getstring(ColumnNames.ImageURL);
			}
			set
	        {
				base.Setstring(ColumnNames.ImageURL, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_Id
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Id) ? string.Empty : base.GetintAsString(ColumnNames.Id);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Id);
				else
					this.Id = base.SetintAsString(ColumnNames.Id, value);
			}
		}

		public virtual string s_NewsDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.NewsDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.NewsDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.NewsDate);
				else
					this.NewsDate = base.SetDateTimeAsString(ColumnNames.NewsDate, value);
			}
		}

		public virtual string s_Headline
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Headline) ? string.Empty : base.GetstringAsString(ColumnNames.Headline);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Headline);
				else
					this.Headline = base.SetstringAsString(ColumnNames.Headline, value);
			}
		}

		public virtual string s_Details
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Details) ? string.Empty : base.GetstringAsString(ColumnNames.Details);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Details);
				else
					this.Details = base.SetstringAsString(ColumnNames.Details, value);
			}
		}

		public virtual string s_Url
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Url) ? string.Empty : base.GetstringAsString(ColumnNames.Url);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Url);
				else
					this.Url = base.SetstringAsString(ColumnNames.Url, value);
			}
		}

		public virtual string s_ImageURL
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ImageURL) ? string.Empty : base.GetstringAsString(ColumnNames.ImageURL);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ImageURL);
				else
					this.ImageURL = base.SetstringAsString(ColumnNames.ImageURL, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter Id
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Id, Parameters.Id);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter NewsDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.NewsDate, Parameters.NewsDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Headline
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Headline, Parameters.Headline);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Details
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Details, Parameters.Details);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Url
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Url, Parameters.Url);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ImageURL
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ImageURL, Parameters.ImageURL);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter Id
		    {
				get
		        {
					if(_Id_W == null)
	        	    {
						_Id_W = TearOff.Id;
					}
					return _Id_W;
				}
			}

			public WhereParameter NewsDate
		    {
				get
		        {
					if(_NewsDate_W == null)
	        	    {
						_NewsDate_W = TearOff.NewsDate;
					}
					return _NewsDate_W;
				}
			}

			public WhereParameter Headline
		    {
				get
		        {
					if(_Headline_W == null)
	        	    {
						_Headline_W = TearOff.Headline;
					}
					return _Headline_W;
				}
			}

			public WhereParameter Details
		    {
				get
		        {
					if(_Details_W == null)
	        	    {
						_Details_W = TearOff.Details;
					}
					return _Details_W;
				}
			}

			public WhereParameter Url
		    {
				get
		        {
					if(_Url_W == null)
	        	    {
						_Url_W = TearOff.Url;
					}
					return _Url_W;
				}
			}

			public WhereParameter ImageURL
		    {
				get
		        {
					if(_ImageURL_W == null)
	        	    {
						_ImageURL_W = TearOff.ImageURL;
					}
					return _ImageURL_W;
				}
			}

			private WhereParameter _Id_W = null;
			private WhereParameter _NewsDate_W = null;
			private WhereParameter _Headline_W = null;
			private WhereParameter _Details_W = null;
			private WhereParameter _Url_W = null;
			private WhereParameter _ImageURL_W = null;

			public void WhereClauseReset()
			{
				_Id_W = null;
				_NewsDate_W = null;
				_Headline_W = null;
				_Details_W = null;
				_Url_W = null;
				_ImageURL_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter Id
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Id, Parameters.Id);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter NewsDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.NewsDate, Parameters.NewsDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Headline
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Headline, Parameters.Headline);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Details
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Details, Parameters.Details);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Url
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Url, Parameters.Url);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ImageURL
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ImageURL, Parameters.ImageURL);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter Id
		    {
				get
		        {
					if(_Id_W == null)
	        	    {
						_Id_W = TearOff.Id;
					}
					return _Id_W;
				}
			}

			public AggregateParameter NewsDate
		    {
				get
		        {
					if(_NewsDate_W == null)
	        	    {
						_NewsDate_W = TearOff.NewsDate;
					}
					return _NewsDate_W;
				}
			}

			public AggregateParameter Headline
		    {
				get
		        {
					if(_Headline_W == null)
	        	    {
						_Headline_W = TearOff.Headline;
					}
					return _Headline_W;
				}
			}

			public AggregateParameter Details
		    {
				get
		        {
					if(_Details_W == null)
	        	    {
						_Details_W = TearOff.Details;
					}
					return _Details_W;
				}
			}

			public AggregateParameter Url
		    {
				get
		        {
					if(_Url_W == null)
	        	    {
						_Url_W = TearOff.Url;
					}
					return _Url_W;
				}
			}

			public AggregateParameter ImageURL
		    {
				get
		        {
					if(_ImageURL_W == null)
	        	    {
						_ImageURL_W = TearOff.ImageURL;
					}
					return _ImageURL_W;
				}
			}

			private AggregateParameter _Id_W = null;
			private AggregateParameter _NewsDate_W = null;
			private AggregateParameter _Headline_W = null;
			private AggregateParameter _Details_W = null;
			private AggregateParameter _Url_W = null;
			private AggregateParameter _ImageURL_W = null;

			public void AggregateClauseReset()
			{
				_Id_W = null;
				_NewsDate_W = null;
				_Headline_W = null;
				_Details_W = null;
				_Url_W = null;
				_ImageURL_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			OleDbCommand cmd = new OleDbCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_NewsFeedInsert]";
	
			CreateParameters(cmd);
			    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			OleDbCommand cmd = new OleDbCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_NewsFeedUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			OleDbCommand cmd = new OleDbCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_NewsFeedDelete]";
	
			OleDbParameter p;
			p = cmd.Parameters.Add(Parameters.Id);
			p.SourceColumn = ColumnNames.Id;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(OleDbCommand cmd)
		{
			OleDbParameter p;
		
			p = cmd.Parameters.Add(Parameters.Id);
			p.SourceColumn = ColumnNames.Id;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.NewsDate);
			p.SourceColumn = ColumnNames.NewsDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Headline);
			p.SourceColumn = ColumnNames.Headline;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Details);
			p.SourceColumn = ColumnNames.Details;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Url);
			p.SourceColumn = ColumnNames.Url;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ImageURL);
			p.SourceColumn = ColumnNames.ImageURL;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
